import type { Role } from "../../role/entity";
import type { UniverseType } from "../../../sde/entity";

export class Asset {
  type?: UniverseType;
  type_id!: number;
  item_id!: number;
  name?: string;
  location_id!: number;

  location?: { id: number; name: string };
  role!: Role;
  parent?: Asset;
  quantity!: number;
  location_flag!: string;
  location_type!: string;
  children: Asset[] = [];

  static from(payload: any) {
    const asset = new Asset();

    Object.assign(asset, payload);
    return asset;
  }
}
